home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / dev / basic / ace24dist.lha / ace24.lha / include / devices / scsidisk.h < prev    next >
C/C++ Source or Header  |  1996-09-10  |  5KB  |  131 lines

  1. #ifndef DEVICES_SCSIDISK_H
  2. #define DEVICES_SCSIDISK_H 1
  3. /*
  4. ** scsidisk.h for ACE Basic
  5. **
  6. ** Note: Translated to ACE by ConvertC2ACE
  7. **       @ MapMeadow Software, Nils Sjoholm
  8. **
  9. **
  10. ** Date: 09/03/95
  11. **
  12. **
  13. */
  14.  
  15.  
  16.  
  17. /*
  18. ** This are the StructPointer defines for scsidisk.h
  19. */
  20. #ifndef SCSICmdPtr
  21. #define SCSICmdPtr ADDRESS
  22. #endif
  23. /*
  24. ** End of StructPointer defines for scsidisk.h
  25. */
  26.       
  27. #ifndef EXEC_TYPES_H
  28. #include <exec/types.h>
  29. #endif /* EXEC_TYPES_H */
  30.  
  31.  
  32.  
  33. /*--------------------------------------------------------------------
  34.  *
  35.  *   SCSI Command
  36.  *  Several Amiga SCSI controller manufacturers are converging on
  37.  *  standard ways to talk to their controllers.  This include
  38.  *  file describes an exec-device command (e.g. for hddisk.device)
  39.  *  that can be used to issue SCSI commands
  40.  *
  41.  *   UNIT NUMBERS
  42.  *  Unit numbers to the OpenDevice call have encoded in them which
  43.  *  SCSI device is being referred to.  The three decimal digits of
  44.  *  the unit number refer to the SCSI Target ID (bus address) in
  45.  *  the 1's digit,  the SCSI logical unit (LUN) in the 10's digit, 
  46.  *  and the controller board in the 100's digit.
  47.  *
  48.  *  Examples:
  49.  *        0 drive at address 0
  50.  *       12 LUN 1 on multiple drive controller at address 2
  51.  *      104 second controller board,  address 4
  52.  *       88 not valid: both logical units and addresses
  53.  *          range from 0..7.
  54.  *
  55.  *   CAVEATS
  56.  *  Original 2090 code did not support this command.
  57.  *
  58.  *  Commodore 2090/2090A unit numbers are different.  The SCSI
  59.  *  logical unit is the 100's digit,  and the SCSI Target ID
  60.  *  is a permuted 1's digit: Target ID 0..6 maps to unit 3..9
  61.  *  (7 is reserved for the controller).
  62.  *
  63.  *      Examples:
  64.  *        3 drive at address 0
  65.  *      109 drive at address 6,  logical unit 1
  66.  *        1 not valid: this is not a SCSI unit.  Perhaps
  67.  *          it's an ST506 unit.
  68.  *
  69.  *  Some controller boards generate a unique name (e.g. 2090A's
  70.  *  iddisk.device) for the second controller board,  instead of
  71.  *  implementing the 100's digit.
  72.  *
  73.  *  There are optional restrictions on the alignment,  bus
  74.  *  accessability,  and size of the data for the data phase.
  75.  *  Be conservative to work with all manufacturer's controllers.
  76.  *
  77.  *------------------------------------------------------------------*/
  78.  
  79. #define HD_SCSICMD  28  /* issue a SCSI command to the unit */
  80.                 /* io_Data points to a SCSICmd */
  81.                 /* io_Length is sizeof(STRUCT SCSICmd) */
  82.                 /* io_Actual and io_Offset are not used */
  83.  
  84. STRUCT SCSICmd  
  85.     ADDRESS   scsi_Data       /* SHORTINT aligned data for SCSI Data Phase */
  86.                 /* (optional) data need not be byte aligned */
  87.                 /* (optional) data need not be bus accessable */
  88.     LONGINT   scsi_Length     /* even length of Data area */
  89.                 /* (optional) data can have odd length */
  90.                 /* (optional) data length can be > 2**24 */
  91.     LONGINT   scsi_Actual     /* actual Data used */
  92.     ADDRESS   scsi_Command    /* SCSI Command (same options as scsi_Data) */
  93.     SHORTINT   scsi_CmdLength  /* length of Command */
  94.     SHORTINT   scsi_CmdActual  /* actual Command used */
  95.     BYTE    scsi_Flags      /* includes intended data direction */
  96.     BYTE    scsi_Status     /* SCSI status of command */
  97.     ADDRESS   scsi_SenseData  /* sense data: filled if SCSIF_[OLD]AUTOSENSE */
  98.                 /* is set and scsi_Status has CHECK CONDITION */
  99.                 /* (bit 1) set */
  100.     SHORTINT   scsi_SenseLength    /* size of scsi_SenseData,  also bytes to */
  101.                 /* request w/ SCSIF_AUTOSENSE,  must be 4..255 */
  102.     SHORTINT   scsi_SenseActual    /* amount actually fetched (0 means no sense) */
  103. END STRUCT 
  104.  
  105.  
  106. /*----- scsi_Flags -----*/
  107. #define SCSIF_WRITE     0   /* intended data direction is out */
  108. #define SCSIF_READ      1   /* intended data direction is in */
  109. #define SCSIB_READ_WRITE    0   /* (the bit to test) */
  110.  
  111. #define SCSIF_NOSENSE       0   /* no automatic request sense */
  112. #define SCSIF_AUTOSENSE     2   /* do standard extended request sense */
  113.                     /* on check condition */
  114. #define SCSIF_OLDAUTOSENSE  6   /* do 4 byte non-extended request */
  115.                     /* sense on check condition */
  116. #define SCSIB_AUTOSENSE     1   /* (the bit to test) */
  117. #define SCSIB_OLDAUTOSENSE  2   /* (the bit to test) */
  118.  
  119. /*----- SCSI io_Error values -----*/
  120. #define HFERR_SelfUnit      40  /* cannot issue SCSI command to self */
  121. #define HFERR_DMA       41  /* DMA error */
  122. #define HFERR_Phase     42  /* illegal or unexpected SCSI phase */
  123. #define HFERR_Parity        43  /* SCSI parity error */
  124. #define HFERR_SelTimeout    44  /* Select timed out */
  125. #define HFERR_BadStatus     45  /* status and/or sense error */
  126.  
  127. /*----- OpenDevice io_Error values -----*/
  128. #define HFERR_NoBoard       50  /* Open failed for non-existant board */
  129.  
  130. #endif  /* DEVICES_SCSIDISK_H */
  131.